package com.yy.permissions_general.module.system.history.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yy.permissions_general.module.system.history.entity.History;
import com.yy.permissions_general.module.system.history.mapper.HistoryMapper;
import com.yy.permissions_general.module.system.history.service.HistoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 更新历史 服务实现类
 * </p>
 *
 * @author YY
 * @since 2022-02-16
 */
@Service
public class HistoryServiceImpl extends ServiceImpl<HistoryMapper, History> implements HistoryService {

    /**
    * 分页查询列表
    * @param history
    * @return
    */
    @Override
    public  Page<History>selectPageList(History history, int limit, int page)  {
        Page pageContext = new Page(page,limit);
        Page<History> pageList = this.baseMapper.selectPage(pageContext, history);
        return pageList;
    }

    /**
    * 新增数据
    * @param history
    */
    @Override
    public int addHistory(History history) {
        return baseMapper.insert(history);
    }

    /**
    * 修改数据
    * @param history
    */
    @Override
    public int editHistory(History history) {
        return baseMapper.updateById(history);
    }

    /**
    * 查看详情
    * @param id
    * @return
    */
    @Override
    public History getDetailsById(Integer id) {
        return baseMapper.selectById(id);
    }

    /**
    * 删除数据
    * @param id
    * @return
    */
    @Override
    public int deleteById(Integer id) {
        return baseMapper.deleteById(id);
    }

    /**
    * 批量删除
    * @param ids
    * @return
    */
    @Override
    public int deleteBatch(List<Long> ids) {
        return baseMapper.deleteBatchIds(ids);
    }

}

